package com.sc.nft.dao;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sc.nft.enums.WalletChannelEnum;
import lombok.extern.slf4j.Slf4j;
import com.sc.nft.entity.DaoCustomerOpenAccount;
import com.sc.nft.mapper.DaoCustomerOpenAccountMapper;
import  com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * (sc_dao_customer_open_account)数据DAO
 *
 * @author zxy
 * @since 2023-11-25 16:18:38
 * @description 商户banner
 */
@Slf4j
@Repository
public class DaoCustomerOpenAccountDao extends ServiceImpl<DaoCustomerOpenAccountMapper, DaoCustomerOpenAccount> {

    public Page<DaoCustomerOpenAccount> getByDaoId(Long daoId, WalletChannelEnum walletChannel, Page page){
        return lambdaQuery().eq(DaoCustomerOpenAccount::getDaoId,daoId).eq(walletChannel!=null,DaoCustomerOpenAccount::getChannel,walletChannel).page(page);
    }

    public DaoCustomerOpenAccount getByChannel(Long daoId, WalletChannelEnum walletChannel){
        return lambdaQuery().eq(DaoCustomerOpenAccount::getDaoId,daoId).eq(DaoCustomerOpenAccount::getChannel,walletChannel).one();
    }


    public DaoCustomerOpenAccount getBySeqNo(String seqNo){
        return lambdaQuery().eq(DaoCustomerOpenAccount::getSeqNo,seqNo).one();
    }

    public DaoCustomerOpenAccount getByDaoIdAndId(Long daoId,Long id){
        return lambdaQuery().eq(DaoCustomerOpenAccount::getDaoId,daoId).eq(DaoCustomerOpenAccount::getId,id).one();
    }
}